package com.haojiang.mh.remote.utils

import com.haojiang.mh.remote.enums.EArea
import com.haojiang.mh.remote.enums.EType


object Constant {


    //连接的阶段
//    const val STEP_CLICK_CONNECT =0x01
//    const val STEP_SELECT_DEVICE =0x02
//    const val STEP_SELECT_INTERFACE = 0x03
//    val AREA_INIT = 0x00


    //发送数据集合
    val TX_END = byteArrayOf(0x6E, 0x01, 0x00, 0x6E, 0xDD.toByte())
    val TX_EXIT_ONE_MIN = byteArrayOf(0x6E, 0x02, 0x01, 0x00, 0x71)
    val TX_ALARM = byteArrayOf(0x6E, 0x08, 0x01, 0x01, 0x78)
    val TX_LED = byteArrayOf(0x6E, 0x0A, 0x00, 0x01, 0x79)
    val TX_AROMA = byteArrayOf(0x6E, 0x1A, 0x00, 0x00, 0x88.toByte())


    val TX_ALARM_CANCLE1 = byteArrayOf(0x6E, 0x05, 0x00, 0x00, 0x73)
    val TX_ALARM_CANCLE2 = byteArrayOf(0x6E, 0x06, 0x00, 0x00, 0x74)


//6d03f1010264
//    val taskMap: HashMap<Int, ByteArray> = hashMapOf(
//        DATA_EXIT_ONE_MIN to byteArrayOf(0x6E, 0x02, 0x01, 0x00, 0x71),
//        DATA_ALARM to byteArrayOf(0x6E, 0x08, 0x01, 0x01, 0x78),
//        DATA_LED to byteArrayOf(0x6E, 0x0A, 0x00, 0x01, 0x79),
//        DATA_AROMA to byteArrayOf(0x6E, 0x1A, 0x00, 0x00, 0x88.toByte())
//    )


    //升降桌功能
    const val RX_HEADER = "6e" //旧协议包头标识
    const val RX_NEW_HEADER = "6d" //新协议包头标识
    const val RX_TABLE_HEIGHT = "6e90" //当前高度(实时高度)
    const val RX_TABLE_HEIGHT_OLD = "6e08" //当前高度(实时高度老版本)
    const val RX_TABLE_INIT = "6e94" //初始化
    const val RX_TABLE_UNIT = "6e92" //设置毫米/英寸
    const val RX_TABLE_ERROR = "6e97" //错误反馈

    //            private static final String RX_TABLE_FEEDBACK = "6e98";       //防夹反馈
    //            private static final String RX_TABLE_FEEDBACK = "6e98";       //防夹反馈
    //闹钟  从控制盒回传到手机 设置成功
    const val RX_ALARM_SET_SUCCESS = "6e07010177" //通知手机闹钟设置成功

    //闹钟  从控制盒回传到手机 取消成功
    const val RX_ALARM_CANCEL_SUCCESS = "6e07010278" //通知手机清除闹钟成功

    const val RX_LED_OFF = "6e0e0001" //LED变色灯此时状态为关
    const val RX_LED_ON = "6e0e0003" //LED变色灯此时状态为开
    const val RX_AROMA_SET_SUCCESS = "6e1a0002" //香薰保存成功
    const val RX_AROMA_SET_FALIURE = "6e1a0003" //香薰保存失败


    const val RX_HAS_ALARM = "6e09010078"           //有闹钟功能
    const val RX_HAS_LED = "6e0e00017d"               //有七彩灯功能
    const val RX_HAS_AROMA = "6e1a000189"          //有香薰功能


    //新协议固定值 6D03000100 71
    val TX_NEW_INIT = byteArrayOf(0x6D, EType.TX.byte, EArea.INIT.key.toByte(), 0x01, 0x00, 0x71) // 6d0300010071 发送所有区域 马达、记忆位置、按摩器
    val TX_NEW_QUERY_MOTOR = byteArrayOf(0x6D, EType.TX.byte, EArea.QUERY.key.toByte(), 0x01, EArea.NEW_MOTOR.key.toByte(), 0x63) //6d03f1010163查询马达区域
    val TX_NEW_QUERY_MEMORY = byteArrayOf(0x6D, EType.TX.byte, EArea.QUERY.key.toByte(), 0x01, EArea.NEW_MEMORY.key.toByte(), 0x64) //6d03f1010264 查询记忆区域
    val TX_NEW_QUERY_MASSAGE = byteArrayOf(0x6D, EType.TX.byte, EArea.QUERY.key.toByte(), 0x01, EArea.NEW_MASSAGE.key.toByte(), 0x65) //6d03f1010365 查询按摩器区域
    val TX_NEW_QUERY_UBL = byteArrayOf(0x6D, EType.TX.byte, EArea.QUERY.key.toByte(), 0x01, EArea.NEW_UBL.key.toByte(), 0x66) //6d03f1010365 查询床底灯区域
    val TX_NEW_QUERY_ALARM = byteArrayOf(0x6D, EType.TX.byte, EArea.QUERY.key.toByte(), 0x01, EArea.NEW_ALARM.key.toByte(), 0x67) //6d03f1010365 查询闹钟区域
    val TX_NEW_QUERY_LED = byteArrayOf(0x6D, EType.TX.byte, EArea.QUERY.key.toByte(), 0x01, EArea.NEW_LED.key.toByte(), 0x68) //6d03f1010365 查询七彩灯区域
    val TX_NEW_QUERY_AROMA = byteArrayOf(0x6D, EType.TX.byte, EArea.QUERY.key.toByte(), 0x01, EArea.NEW_AROMA.key.toByte(), 0x69) //6d03f1010365 查询香薰区域

    //新协议
    const val RX_NEW_INIT = "6d0300"                     //新协议接收初始化参数
    const val RX_NEW_MOTOR = "6d0601"               //马达
    const val RX_NEW_MEMORY = "6d0302"            //记忆位置
    const val RX_NEW_MASSAGE = "6d0303"          //按摩器
    const val RX_NEW_UBL = "6d0304"                     //UBL
    const val RX_NEW_ALARM = "6d0305"               //闹钟
    const val RX_NEW_LED = "6d0306"                      //七彩灯
    const val RX_NEW_USB = "6d0307"                     //USB
    const val RX_NEW_TIME = "6d03e0"                   //时间校准
    const val RX_NEW_DETECT = "6d03e1"              //错误检测
    const val RX_NEW_STATUS = "6d03f0"             //状态
    const val RX_NEW_QUERY = "6d03f1"               //查询


    val rxList: ArrayList<String> = arrayListOf(
        RX_TABLE_HEIGHT,
        RX_TABLE_HEIGHT_OLD,
        RX_TABLE_INIT,
        RX_TABLE_UNIT,
        RX_TABLE_ERROR,

        RX_ALARM_SET_SUCCESS,
        RX_ALARM_CANCEL_SUCCESS,

        RX_LED_OFF,
        RX_LED_ON,

        RX_AROMA_SET_SUCCESS,
        RX_AROMA_SET_FALIURE,

        RX_HAS_ALARM,
        RX_HAS_LED,
        RX_HAS_AROMA
    )

    val rxNewList = arrayListOf<String>(
        RX_NEW_INIT
    )


    //设备组选项
//    const val NORMAL_TEST = 0x00
//    const val NORMAL_SINGLE =  0x01
//    const val GROUP_TEST = 0x10
//    const val GROUP_SINGLE = 0x11
//    const val GROUP_MULTIPLE = 0x12
//    const val GROUP_SPLIT = 0x13


//    const val GROUP_TYPE_NONE =  -1
//    const val GROUP_TYPE_SINGLE = 0x00
//    const val GROUP_TYPE_MULTIPLE = 0x01
//    const val GROUP_TYPE_SPLIT = 0x02

    //设备组
//    val bleType = arrayListOf<Int>(
//        BLE_SINGLE,
//        BLE_MULTIPLE,
//        BLE_COUPLE
//    )

//        {
//            add(RX_TABLE_HEIGHT);
//            add(RX_TABLE_HEIGHT_OLD);
//            add(RX_TABLE_INIT);
//            add(RX_TABLE_UNIT);
//            add(RX_TABLE_ERROR);
//
//            add(RX_ALARM_SET);
//            add(RX_ALARM_CANCEL);
//            add(RX_HAS_ALARM);
//            add(RX_LED_OFF);
//            add(RX_LED_ON);
//            add(RX_HAS_AROMA);
//            add(RX_AROMA_SUCCESS);
//            add(RX_AROMA_FALIURE);
//        }
//    }


    val QRRM = "qrrm"

    //item条目标识
//    val ITEM_HEAD = 0x01
//    val ITEM_FOOT = 0x02
//    val ITEM_PILLOW = 0x03
//    val ITEM_LUMBAR = 0x04
//    val ITEM_HEAD_FOOT_BOTH = 0x05
//    val ITEM_PILLOW_LUMBAR_BOTH = 0x06
//    val ITEM_UBL_ON_OFF = 0x07
//    val ITEM_UBL_OFF = 0x08
//    val ITEM_FLAT = 0x09
//    val ITEM_HEAD_UP_FOOT_UP = 0x0A //一键同步上升

//    val ITEM_MEM_TV = 0x11
//    val ITEM_MEM_ZG = 0x12
//    val ITEM_MEM_SNORE = 0x13
//    val ITEM_MEM_LOUNGE = 0x14
//    val ITEM_MEM_M1 = 0x15
//    val ITEM_MEM_M2 = 0x16
//    val ITEM_MEM_M3 = 0x17
//    val ITEM_MEM_LUMBAR = 0x18                      //腰托
//    val ITEM_MEM_FLAT2 = 0x19
//    val ITEM_MEM_RELAX = 0x1A
//    val ITEM_MEM_FACTORY_RESET = 0x1B

//    val ITEM_MSG_HEAD_FOOT_INTENSITY_INC = 0x21
//    val ITEM_MSG_HEAD_FOOT_INTENSITY_DEC = 0x22
//    val ITEM_MSG_HEAD_FOOT_BOTH_INTENSITY = 0x23
//    val ITEM_MSG_HEAD_FOOT_SPEED = 0x24
//    val ITEM_MSG_HEAD_FOOT_ON_OFF = 0x25
//    val ITEM_MSG_STYLE = 0x26
//    val ITEM_MSG_MODE = 0x27
//    val ITEM_MSG_MIN = 0x28
//    val ITEM_MSG_HEAD_FOOT_BOTH_ON = 0x29
//    val ITEM_MSG_HEAD_FOOT_BOTH_OFF = 0x2A

//    val ITEM_ALARM_TV = 0x31
//    val ITEM_ALARM_ZG = 0x32
//    val ITEM_ALARM_SNORE = 0x33
//    val ITEM_ALARM_LOUNGE = 0x34
//    val ITEM_ALARM_M1 = 0x35
//    val ITEM_ALARM_M2 = 0x36
//    val ITEM_ALARM_M3 = 0x37

    //床图片
//    val BED_NONE = 0x00
//    val BED_HEAD = 0x01
//    val BED_FOOT = 0x02
//    val BED_PILLOW = 0x03
//    val BED_LUMBAR = 0x04
//    val BED_ALL = 0x05

    //芯片提供商
//    val NORDIC = 0x01
//    val WLT = 0x02

    //Nordic的蓝牙数据服务
    const val UUID_SERVICE_N1 = "6e400001-b5a3-f393-e0a9-e50e24dcca9e"
    const val UUID_CHARACTERISTIC_WRITE_N1 = "6e400002-b5a3-f393-e0a9-e50e24dcca9e"
    const val UUID_CHARACTERISTIC_READ_N1 = "6e400003-b5a3-f393-e0a9-e50e24dcca9e"

    //维霖通1的蓝牙数据服务
    const val UUID_SERVICE_W1 = "0000FEE9-0000-1000-8000-00805F9B34FB"
    const val UUID_CHARACTERISTIC_WRITE_W1 = "D44BC439-ABFD-45A2-B575-925416129600"
    const val UUID_CHARACTERISTIC_READ_W1 = "D44BC439-ABFD-45A2-B575-925416129601"

    //维霖通2的蓝牙数据服务
    const val UUID_SERVICE_W2 = "0000FEE9-0000-1000-8000-00805F9B34BB"
    const val UUID_CHARACTERISTIC_WRITE_W2 = "D44BC439-ABFD-45A2-B575-925416129622"
    const val UUID_CHARACTERISTIC_READ_W2 = "D44BC439-ABFD-45A2-B575-925416129611"


    //维霖通3的蓝牙命令服务
    const val UUID_SERVICE_W3 = "0000FFE0-0000-1000-8000-00805F9B34FB"
    const val UUID_CHARACTERISTIC_WRITE_W3 = "0000FFE2-0000-1000-8000-00805F9B34FB"
    const val UUID_CHARACTERISTIC_READ_W3 = "0000FFE1-0000-1000-8000-00805F9B34FB"

    //维霖通4的蓝牙命令服务
    const val UUID_SERVICE_W4 = "0000FFF0-0000-1000-8000-00805F9B34FB"
    const val UUID_CHARACTERISTIC_WRITE_W4 = "0000FFF2-0000-1000-8000-00805F9B34FB"
    const val UUID_CHARACTERISTIC_READ_W4 = "0000FFF1-0000-1000-8000-00805F9B34FB"




    //维霖通的蓝牙数据服务
//    val UUID_SERVICE_W1 = UUID.fromString("0000fee9-0000-1000-8000-00805f9b34fb")
//    val UUID_CHARACTERISTIC_WRITE_W1 = UUID.fromString("d44bc439-abfd-45a2-b575-925416129600")
//    val UUID_CHARACTERISTIC_READ_W1 = UUID.fromString("d44bc439-abfd-45a2-b575-925416129601")
//
//    //维霖通2的蓝牙数据服务
//    val UUID_SERVICE_W2 = UUID.fromString("0000fee9-0000-1000-8000-00805f9b34bb")
//    val UUID_CHARACTERISTIC_WRITE_W2 = UUID.fromString("d44bc439-abfd-45a2-b575-925416129622")
//    val UUID_CHARACTERISTIC_READ_W2 = UUID.fromString("d44bc439-abfd-45a2-b575-925416129611")
//
//
//    //维霖通3的蓝牙命令服务
//    val UUID_SERVICE_W3 = UUID.fromString("0000ffe0-0000-1000-8000-00805f9b34fb")
//    val UUID_CHARACTERISTIC_WRITE_W3 = UUID.fromString("0000ffe2-0000-1000-8000-00805f9b34fb")
//    val UUID_CHARACTERISTIC_READ_W3 = UUID.fromString("0000ffe1-0000-1000-8000-00805f9b34fb")
//
//    //维霖通4的蓝牙命令服务
//    val UUID_SERVICE_WL4 = UUID.fromString("0000fff0-0000-1000-8000-00805f9b34fb")
//    val UUID_CHARACTERISTIC_WRITE_W4 = UUID.fromString("0000fff2-0000-1000-8000-00805f9b34fb")
//    val UUID_CHARACTERISTIC_READ_W4 = UUID.fromString("0000fff1-0000-1000-8000-00805f9b34fb")
//
//    //Nordic的蓝牙数据服务
////    public static final String UUID_SERVICE_DATA_N = "6E400001-B5A3-F393-E0A9-E50E24DCCA9E";
////    public static final String UUID_CHARACTERISTIC_DATA_READ_N = "6E400003-B5A3-F393-E0A9-E50E24DCCA9E";
////    public static final String UUID_CHARACTERISTIC_DATA_WRITE_N = "6E400002-B5A3-F393-E0A9-E50E24DCCA9E";
//
//    //Nordic的蓝牙数据服务
////    public static final String UUID_SERVICE_DATA_N = "6E400001-B5A3-F393-E0A9-E50E24DCCA9E";
////    public static final String UUID_CHARACTERISTIC_DATA_READ_N = "6E400003-B5A3-F393-E0A9-E50E24DCCA9E";
////    public static final String UUID_CHARACTERISTIC_DATA_WRITE_N = "6E400002-B5A3-F393-E0A9-E50E24DCCA9E";
//    val UUID_SERVICE_N1 = UUID.fromString("6e400001-b5a3-f393-e0a9-e50e24dcca9e")
//    val UUID_CHARACTERISTIC_WRITE_N1 = UUID.fromString("6e400002-b5a3-f393-e0a9-e50e24dcca9e")
//    val UUID_CHARACTERISTIC_READ_N1 = UUID.fromString("6e400003-b5a3-f393-e0a9-e50e24dcca9e")


//    //Nordic2的蓝牙服务
//    public static final String UUID_SERVICE_N2 = "6e400001-b5a3-f393-e0a9-e50e24dcca9e";
//    public static final String UUID_CHARACTERISTIC_WRITE_N2 = "6E400002-B5A3-F393-E0A9-E50E24DCCA9E";
//    public static final String UUID_CHARACTERISTIC_READ_N2 = "6E400003-B5A3-F393-E0A9-E50E24DCCA9E";
}